﻿@model ProductReviewsModel
@using Nop.Web.Models.Catalog;
@using Nop.Core.Domain.Catalog;
    <div class="product-review-block">
        @Html.Widget("productreviews_page_top")
        @if (Model.AddProductReview.SuccessfullyAdded)
        {
            <div class="result">
                @Model.AddProductReview.Result
            </div>
        }

        @if (Model.Items.Count > 0)
        {
            <div class="product-review-list">

                @for (int i = 0; i < Model.Items.Count && i < 5; i++ )
                {
                    var review = Model.Items[i];                      
                    <div class="product-review-item">
                        <h4 class="review-title">
                            @review.Title
                        </h4>
                        <div class="product-rating" title="@review.Rating">
                            @{
                                decimal ratePercent = review.Rating * 100 / 5;
                                @Html.Partial("_ProductReviewStars", new ProductReviewStarsModel()
                                {
                                    ShowCount = false,
                                    RatingPercent = ratePercent
                                })
                            }
                        </div>
                        <div class="review-customer">
                            @if (review.AllowViewingProfiles)
                            {
                                <a href="@Url.RouteUrl("CustomerProfile", new { id = review.CustomerId })">@(review.CustomerName)</a>
                            }
                            else
                            {
                                @review.CustomerName
                            }
                            <span class="separator">-</span>
                            @review.WrittenOnStr

                        </div>                   
                        <div class="review-text">
                            @Html.Raw(Nop.Core.Html.HtmlHelper.FormatText(review.ReviewText, false, true, false, false, false, false))
                        </div>
                        @Html.Partial("_ProductReviewHelpfulness", review.Helpfulness, new ViewDataDictionary())
                        @Html.Widget("productreviews_page_inside_review")
                    </div>
                }
            </div>
        }
        @Html.Widget("productreviews_page_bottom")
    </div>
